CMake基础 第9节 使用Clang编译 | 您所在的位置:网站首页 › clang toolchains › CMake基础 第9节 使用Clang编译 |
引言
当使用CMake构建时,可以设置C和C++编译器。此示例与hello-cmake示例相同,只是它显示了将编译器从默认的GCC更改为clang的最基本方法。 本教程中的文件如下: $ tree . ├── CMakeLists.txt ├── main.cpp[CMakeLists.txt] - 包含要运行的CMake命令。 # Set the minimum version of CMake that can be used # To find the cmake version run # $ cmake --version cmake_minimum_required(VERSION 3.5) # Set the project name project (hello_cmake) # Add an executable add_executable(hello_cmake main.cpp)[main.cpp] - 一个简单的“Hello World”C++文件。 #include int main(int argc, char *argv[]) { std::cout |
CopyRight 2018-2019 实验室设备网 版权所有 |